//
//  UIButton+Extension.swift
//  微博Swift
//
//  Created by  justinchou on 16/2/25.
//  Copyright © 2016年  justinchou. All rights reserved.
//

import UIKit

extension UIButton {
    
    convenience init(title: String, color: UIColor, backgroundImageName: String) {
        self.init()
        setTitle(title, forState: .Normal)
        setTitleColor(color, forState: .Normal)
        setBackgroundImage(UIImage(named: backgroundImageName), forState: .Normal)
    }
    
    convenience init(title: String, fontSize: CGFloat, imageName: String, backgroundImageName: String) {
        self.init()
        setTitle(title, forState: .Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
        setImage(UIImage(named: imageName), forState: .Normal)
        setBackgroundImage(UIImage(named: backgroundImageName), forState: .Normal)
        setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        sizeToFit()
    }
}